<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{$Think.config.site.title} - 设备列表</title>
    <meta name="keywords" content="{$Think.config.site.keywords}">
    <meta name="description" content="{$Think.config.site.description}">
    <link href="{$Think.config.site.resource_url}css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/plugins/chosen/chosen.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/animate.min.css" rel="stylesheet">
    
    <link href="{$Think.config.site.resource_url}css/style.min.css?v=4.0.0" rel="stylesheet">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
            <form method="post" class="form-horizontal" id="myfoms">
            <input type="hidden" name="id" value="{$v['id']}" id="id1">
                <div class="ibox-content">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">{:lang('选择代理商')}</label>
                        <div class="col-sm-5">
                            <div class="input-group" id="shhu">
                                <select data-placeholder="{:lang('选择代理商')}..." class="form-control chosen-select" name="oid" id="oid" required ="required">
                                    <option value="" >{:lang('选择代理商')}</option>
                                    {volist name="o" id="vo"}
                                    <option value="{$vo.id}" hassubinfo="true" {if condition="$vo['id'] eq $v['oid']"} selected {/if}>{$vo.name}</option>
                                    {/volist}
                                    
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                    <div class="form-group">
                        <label class="col-sm-4 control-label">{:lang('选择所在商铺')}</label>
                        <div class="col-sm-5">
                            <div class="input-group">
                                <select data-placeholder="{:lang('选择所在商铺')}..." class="form-control" name="sid" id="sid" required ="required">
                                    <option value="" >{:lang('选择所在商铺')}</option>
                                    {volist name="list" id="vv"}
                                    <option value="{$vv.id}" hassubinfo="true" {if condition="$vv['id'] eq $v['sid']"} selected {/if}>{$vv.name}</option>
                                    {/volist}
                                    
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                    <div class="form-group">
                        <label class="col-sm-4 control-label">{:lang('机柜ID')}</label>
                        <div class="col-sm-5">
                            <input id="cabinet_id" name="cabinet_id" class="form-control" type="text" value="{$v.cabinet_id}" required ="required">

                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                    <div class="form-group">
                        <label class="col-sm-4 control-label">{:lang('机柜型号')}</label>
                        <div class="col-sm-5">
                            <input id="model" name="model" class="form-control" type="text" value="{$v.model}" required ="required">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-4 control-label">{:lang('充电宝槽数')}</label>
                        <div class="col-sm-5">
                            <input id="devicenum" name="devicenum" class="form-control" type="text" value="{$v.devicenum}" required ="required">
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                    <div class="form-group">
                       <label class="col-sm-4 control-label">{:lang('模式')}</label>
                        <div class="col-sm-5">
                           <div class="radio radio-info radio-inline">
                                <input type="radio" id="inlineRadio1" value="1" name="mode" {if condition="$v['mode'] eq '1'"}  checked="checked" {/if} >
                                <label for="inlineRadio1"> {:lang('运营')} </label>
                            </div>
                            <div class="radio radio-info radio-inline">
                                <input type="radio" id="inlineRadio2" value="2" name="mode" {if condition="$v['mode'] eq '2'"}  checked="checked" {/if} >
                                <label for="inlineRadio2"> {:lang('调试')} </label>
                            </div>
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                    <div class="form-group">
                        <div class="col-sm-4 col-sm-offset-2">

                            <button class="btn btn-primary " type="button" id="bton"><i class="fa fa-check"></i>&nbsp;{:lang('提交')}&nbsp;</button>
                   
                        </div>
                    </div>
                </div></form>
            </div>
            
        </div>
    </div>
</div>

<script src="{$Think.config.site.resource_url}js/jquery.min.js?v=2.1.4"></script>
<script src="{$Think.config.site.resource_url}js/bootstrap.min.js?v=3.3.5"></script>
<script src="{$Think.config.site.resource_url}js/plugins/peity/jquery.peity.min.js"></script>
<script src="{$Think.config.site.resource_url}js/plugins/chosen/chosen.jquery.js"></script>
<script src="{$Think.config.site.resource_url}js/plugins/iCheck/icheck.min.js"></script>
<script src="{$Think.config.site.resource_url}js/plugins/layer/layer.js"></script>
<script type="text/javascript">
$(".chosen-select").chosen({disable_search_threshold: 5});
</script>
<script type="text/javascript">
$(function(){
    $('#oid').change(function(){
        var oid = $(this).val();
        $.ajax({
                type : 'POST',
                url  : '<?php echo \think\Request::instance()->root(); ?>/ausadmin/Equipment/sellers',
                dataType : 'json',
                data : {oid:oid},
                async : false,
                success : function(result){
                   if(0 == result.code){
                       $('#sid').html( result.msg );
                       // $("#seller>div#sid_chosen>div.chosen-drop>ul.chosen-results").html("1223333" );
                    }
                       
                },
            });
    });
    $('#bton').click(function(){
        var formdata = $('#myfoms').serialize();
        $.ajax({
            type : 'POST',
            url  : '<?php echo \think\Request::instance()->root(); ?>/ausadmin/Equipment/edit',
            dataType : 'json',
            data : formdata,
            async : false,
            success : function(result){
                if(0 == result.code){
                    parent.location.reload();
                    layer.msg(result.msg, {icon: 1});

                }else{
                    layer.msg(result.msg, {icon: 5});
                }
            },
            error : function(){
                layer.msg("{:lang('服务器错误！请稍后重试')}", {icon: 2});
            }
        })
    });
});
</script>
</body>
</html>